/*     */ package com.lmpop.trade.ti_roleright;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Arrays;
/*     */ import java.util.HashSet;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_rolerightInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_rolerightInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  28 */     Ti_roleright ti_roleright = new Ti_roleright();
/*     */ 
/*  30 */     String cust_id = map.getString("session_cust_id");
/*  31 */     String role_code = map.getString("role_code");
/*  32 */     String menu_id = map.getString("menu_id");
/*  33 */     String user_id = map.getString("session_user_id");
/*  34 */     ti_roleright.setCust_id(cust_id);
/*  35 */     ti_roleright.setRole_code(role_code);
/*  36 */     ti_roleright.setOper_user_id(user_id);
/*     */ 
/*  38 */     String result_code = "0";
/*     */     try {
/*  40 */       List al = getRoleRightInfoByRole(cust_id, role_code);
/*  41 */       if ((al != null) && (al.size() > 0)) {
/*  42 */         del(dbmMgr, cust_id, role_code);
/*     */       }
/*  44 */       if (!menu_id.equals("")) {
/*  45 */         String[] pkStr = menu_id.split("\\|");
/*  46 */         HashSet set = new HashSet();
/*  47 */         set.addAll(Arrays.asList(pkStr));
/*  48 */         pkStr = (String[])(String[])set.toArray(new String[0]);
/*  49 */         for (int i = 0; i < pkStr.length; i++) {
/*  50 */           ti_roleright.setMenu_id(pkStr[i]);
/*  51 */           if (pkStr[i].equals("")) continue; insert(dbmMgr, ti_roleright);
/*     */         }
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  56 */       e.printStackTrace();
/*  57 */       result_code = "1";
/*     */     }
/*  59 */     map.setString("result_code", result_code);
/*  60 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_roleright ti_roleright)
/*     */     throws ApplicationException
/*     */   {
/*  70 */     dbmMgr.update("insertTi_roleright", ti_roleright);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  81 */     String pkid_string = map.getString("pkid");
/*  82 */     String cust_id = map.getString("session_cust_id");
/*     */ 
/*  84 */     String result_code = "0";
/*     */     try {
/*  86 */       if (!pkid_string.equals("")) {
/*  87 */         String[] pkStr = pkid_string.split("\\|");
/*  88 */         for (int i = 0; i < pkStr.length; i++)
/*  89 */           if (!pkStr[i].equals(""))
/*  90 */             del(dbmMgr, cust_id, pkStr[i]);
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  94 */       e.printStackTrace();
/*  95 */       result_code = "1";
/*     */     }
/*  97 */     map.setString("result_code", result_code);
/*  98 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 107 */     dbmMgr.update("deleteTi_roleright", pkid);
/*     */   }
/*     */ 
/*     */   public void del(DbmInterf dbmMgr, String cust_id, String role_code)
/*     */     throws ApplicationException
/*     */   {
/* 117 */     Ti_roleright ti_roleright = new Ti_roleright();
/* 118 */     ti_roleright.setCust_id(cust_id);
/* 119 */     ti_roleright.setRole_code(role_code);
/* 120 */     dbmMgr.update("delTi_roleright", ti_roleright);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 130 */     Ti_roleright ti_roleright = new Ti_roleright();
/* 131 */     ti_roleright.setCust_id(map.getString("cust_id"));
/* 132 */     ti_roleright.setRole_code(map.getString("role_code"));
/* 133 */     ti_roleright.setMenu_id(map.getString("menu_id"));
/* 134 */     ti_roleright.setOper_user_id(map.getString("oper_user_id"));
/*     */ 
/* 137 */     String result_code = "0";
/*     */     try {
/* 139 */       update(dbmMgr, ti_roleright);
/*     */     } catch (ApplicationException e) {
/* 141 */       e.printStackTrace();
/* 142 */       result_code = "1";
/*     */     }
/* 144 */     map.setString("result_code", result_code);
/* 145 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_roleright ti_roleright)
/*     */     throws ApplicationException
/*     */   {
/* 154 */     dbmMgr.update("updateTi_roleright", ti_roleright);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 165 */     Ti_roleright ti_roleright = (Ti_roleright)obj;
/* 166 */     if (start == 0)
/* 167 */       start = 0;
/*     */     else {
/* 169 */       start = (start - 1) * limit;
/*     */     }
/* 171 */     ti_roleright.setStart(Integer.valueOf(start));
/* 172 */     ti_roleright.setLimit(Integer.valueOf(limit));
/* 173 */     return this.queryList.getList("getTi_rolerightList", ti_roleright);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 184 */     Ti_roleright ti_roleright = (Ti_roleright)obj;
/* 185 */     List list = this.queryList.getList("getCountByObjTi_custlink", ti_roleright);
/* 186 */     int count = 0;
/* 187 */     if ((list != null) && (list.size() > 0)) {
/* 188 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 189 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 190 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 193 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 203 */     return this.queryList.getList("getTi_rolerightByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getRoleRightInfoByRole(String cust_id, String role_code)
/*     */   {
/* 213 */     Ti_roleright ti_roleright = new Ti_roleright();
/* 214 */     ti_roleright.setCust_id(cust_id);
/* 215 */     ti_roleright.setRole_code(role_code);
/* 216 */     return this.queryList.getList("getRoleRightInfo_Role", ti_roleright);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_roleright.Ti_rolerightInfo
 * JD-Core Version:    0.6.0
 */